home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3x / cpusetAllocQueueDef.z / cpusetAllocQueueDef
Encoding:
Text File  |  2002-10-03  |  12.6 KB  |  265 lines

  1.  
  2.  
  3.  
  4. ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))                                ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cpusetAllocQueueDef - allocate a cpuset_QueueDef_t structure
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ccccppppuuuusssseeeetttt....hhhh>>>>
  13.  
  14.      ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt ****ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((iiiinnnntttt ccccoooouuuunnnntttt))))
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The _c_p_u_s_e_t_A_l_l_o_c_Q_u_e_u_e_D_e_f function is used to allocate memory for a
  18.      ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt structure.  This memory can then be released using the
  19.      function _c_p_u_s_e_t_F_r_e_e_Q_u_e_u_e_D_e_f(3x).
  20.  
  21.      The ccccoooouuuunnnntttt argument indicates the number of CPUs that will be assigned to
  22.      the cpuset definition structure.  The ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt structure is
  23.      defined as follows:
  24.  
  25.                typedef struct {
  26.                    int                flags;
  27.                    char               *permfile;
  28.                    cpuset_CPUList_t   *cpu;
  29.                } cpuset_QueueDef_t;
  30.  
  31.  
  32.      The ffffllllaaaaggggssss member is used to specify various control options for the
  33.      cpuset queue.  It is formed by OR-ing together zero or more of the
  34.      following values:
  35.  
  36.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______CCCC_PPPP_UUUU______EEEE_XXXX_CCCC_LLLL_UUUU_SSSS_IIII_VVVV_EEEE
  37.             Defines a cpuset to be restricted.  Only threads attached to the
  38.             cpuset queue (descendents of an attached thread inherit the
  39.             attachement) may execute on the CPUs contained in the cpuset.
  40.  
  41.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______LLLL_OOOO_CCCC_AAAA_LLLL
  42.             Threads assigned to the cpuset will attempt to assign memory only
  43.             from nodes within the cpuset.  Assignment of memory from outside
  44.             the cpuset will occur only if no free memory is available from
  45.             within the cpuset.  No restrictions are made on memory assignment
  46.             to threads running outside the cpuset.
  47.  
  48.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______EEEE_XXXX_CCCC_LLLL_UUUU_SSSS_IIII_VVVV_EEEE
  49.             Threads assigned to the cpuset will attempt to assign memory only
  50.             from nodes within the cpuset.  Assignment of memory from outside
  51.             the cpuset will occur only if no free memory is available from
  52.             within the cpuset.  Threads not assigned to the cpuset will not
  53.             use memory from within the cpuset unless no memory outside the
  54.             cpuset is available.  If, at the time a cpuset is created, memory
  55.             is already assigned to threads that are already running, no
  56.             attempt will be made to explicitly move this memory.  If page
  57.             migration is enabled, the pages will be migrated when the system
  58.             detects that most references to the pages are non-local.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))                                ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))
  71.  
  72.  
  73.  
  74.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______KKKK_EEEE_RRRR_NNNN_EEEE_LLLL______AAAA_VVVV_OOOO_IIII_DDDD
  75.             The kernel should attempt to avoid allocating memory from nodes
  76.             contained in this cpuset. If kernel memory requests cannot be
  77.             satisfied from outside this cpuset, this option will be ignored
  78.             and allocations will occur from within the cpuset. (This avoidance
  79.             currently extends only to keeping buffer cache away from the
  80.             protected nodes.)
  81.  
  82.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______MMMM_AAAA_NNNN_DDDD_AAAA_TTTT_OOOO_RRRR_YYYY
  83.             The kernel will limit all memory allocations to nodes that are
  84.             contained in this cpuset. If memory requests cannot be satisfied,
  85.             the allocating process will sleep until memory is available. The
  86.             process will be killed if no more memory can be allocated. See
  87.             policies below.
  88.  
  89.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______PPPP_OOOO_LLLL_IIII_CCCC_YYYY______PPPP_AAAA_GGGG_EEEE
  90.             Requires MEMORY_MANDATORY. This is the default policy if no policy
  91.             is specified. This policy will cause the kernel to page user pages
  92.             to the swap file (see _s_w_a_p(1M)) to free physical memory on the
  93.             nodes contained in this cpuset. If swap space is exhausted, the
  94.             process will be killed.
  95.  
  96.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______PPPP_OOOO_LLLL_IIII_CCCC_YYYY______KKKK_IIII_LLLL_LLLL
  97.             Requires MEMORY_MANDATORY. The kernel will attempt to free as much
  98.             space as possible from kernel heaps, but will not page user pages
  99.             to the swap file.  If all physical memory on the nodes contained
  100.             in this cpuset are exhausted, the process will be killed.
  101.  
  102.      The ppppeeeerrrrmmmmffffiiiilllleeee member is the name of the file that defines the access
  103.      permissions for the cpuset queue.  The file permissions of filename
  104.      referenced by permfile define access to the cpuset.  Every time
  105.      permissions need to be checked, the current permissions of this file are
  106.      used.  Thus, it is possible to change the access to a particular cpuset
  107.      without having to tear it down and recreate it, simply by changing the
  108.      access permissions.  Read access to the permfile allows a user to
  109.      retrieve information about a cpuset, while execute permission allows the
  110.      user to attach a process to the cpuset.
  111.  
  112.      The ccccppppuuuu member is a pointer to a ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure.  The memory
  113.      for the ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure is allocated and released when the
  114.      ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt structure is allocated and released (see
  115.      cpusetFreeQueueDef(3x)). The ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure contains the list
  116.      of CPUs assigned to the cpuset.  The ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure (defind
  117.      in <cpuset.h>) is defined as follows:
  118.  
  119.                typedef struct {
  120.                    int     count;
  121.                    cpuid_t *list;
  122.                } cpuset_CPUList_t;
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))                                ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))
  137.  
  138.  
  139.  
  140.      The ccccoooouuuunnnntttt member defines the number of CPUs contained in the list.
  141.  
  142.      The lllliiiisssstttt member is the pointer to the list (an allocated array) of the
  143.      CPU IDs.  The memory for the lllliiiisssstttt array is allocated and released when
  144.      the ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure is allocated and released.  The size of
  145.      the list is determined by the ccccoooouuuunnnntttt argument passed into the function
  146.      _c_p_u_s_e_t_A_l_l_o_c_Q_u_e_u_e_D_e_f.
  147.  
  148. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  149.      This example creates a cpuset queue using _c_p_u_s_e_t_C_r_e_a_t_e(3x) and provides
  150.      an example of how _c_p_u_s_e_t_A_l_l_o_c_Q_u_e_u_e_D_e_f might be used.  The cpuset created
  151.      will have access controlled by the file _////_uuuu_ssss_rrrr_////_tttt_mmmm_pppp_////_mmmm_yyyy_pppp_eeee_rrrr_mmmm_ffff_iiii_llll_eeee; it will
  152.      contain CPU IDs 4, 8, and 12; and it will be CPU exclusive and memory
  153.      exclusive:
  154.  
  155.                cpuset_QueueDef_t *qdef;
  156.                char              *qname = "myqueue";
  157.  
  158.                /* Alloc queue def for 3 CPU IDs */
  159.                qdef = cpusetAllocQueueDef(3);
  160.                if (!qdef) {
  161.                    perror("cpusetAllocQueueDef");
  162.                    exit(1);
  163.                }
  164.  
  165.                /* Define attributes of the cpuset */
  166.                qdef->flags = CPUSET_CPU_EXCLUSIVE
  167.                            | CPUSET_MEMORY_EXCLUSIVE;
  168.                qdef->permfile = "/usr/tmp/mypermfile"
  169.                qdef->cpu->count = 3;
  170.                qdef->cpu->list[0] = 4;
  171.                qdef->cpu->list[1] = 8;
  172.                qdef->cpu->list[2] = 12;
  173.  
  174.                /* Request that the cpuset be created */
  175.                if (!cpusetCreate(qname, qdef)) {
  176.                    perror("cpusetCreate");
  177.                    exit(1);
  178.                }
  179.                cpusetFreeQueueDef(qdef);
  180.  
  181.  
  182. NNNNOOOOTTTTEEEESSSS
  183.      _c_p_u_s_e_t_A_l_l_o_c_Q_u_e_u_e_D_e_f is found in the library "libcpuset.so", and will be
  184.      loaded if the option _----_llll_cccc_pppp_uuuu_ssss_eeee_tttt is used with _cccc_cccc(1) or _llll_dddd(1).
  185.  
  186. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  187.      cpuset(1), cpusetAllocQueueDef(3x), cpusetFreeQueueDef(3x).  cpuset(5).
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))                                ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff((((3333xxxx))))
  203.  
  204.  
  205.  
  206. DIAGNOSTICS
  207.      If successful, _c_p_u_s_e_t_A_l_l_o_c_Q_u_e_u_e_D_e_f returns a pointer to a
  208.      ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt structure.  If _c_p_u_s_e_t_A_l_l_o_c_Q_u_e_u_e_D_e_f fails, it returns
  209.      NULL and eeeerrrrrrrrnnnnoooo is set to indicate the error.  The possible eeeerrrrrrrrnnnnoooo values
  210.      include those returned by _ssss_bbbb_rrrr_kkkk(2) and the following:
  211.  
  212.      EEEEIIIINNNNVVVVAAAALLLL
  213.           Invalid argument was supplied.  The user must supply a value greater
  214.           than or equal to 0.
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.